package com.neulogistics.core.substation.infrastructure.persistence.orm.po;

import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import java.util.Date;

import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import lombok.Data;

/**
 * 任务单表
 * @TableName tb_task_order
 */
@TableName(value ="tb_task_order", autoResultMap = true)
@Data
public class TaskOrderPO implements Serializable {
    /**
     * 任务单id
     */
    @TableId(value = "task_id")
    private Long taskId;

    /**
     * 任务类型：1:送货收款；2:退货；3:换货
     */
    @TableField(value = "task_type")
    private Integer taskType;

    /**
     * 任务状态：0:待货；1:待分配；2:待领货；3:待配送；4:已完成
     */
    @TableField(value = "task_status")
    private Integer taskStatus;

    /**
     * 所属分站id
     */
    @TableField(value = "substation_id")
    private Integer substationId;

    /**
     * 关联订单信息，{订单id、订单项、总额、备注、收货地址、收货人名、收货人电话、发票需求、期望配送时间}
     */
    @TableField(value = "order_info", typeHandler = JacksonTypeHandler.class)
    private JSONObject orderInfo;

    /**
     * 订单客户信息，{客户id、客户名、客户电话}
     */
    @TableField(value = "custom_info", typeHandler = JacksonTypeHandler.class)
    private JSONObject customInfo;

    /**
     * 配送员{userId，name}
     */
    @TableField(value = "courier_info", typeHandler = JacksonTypeHandler.class)
    private JSONObject courierInfo;

    /**
     * 备注
     */
    @TableField(value = "task_remark")
    private String taskRemark;

    /**
     * 发票号
     */
    @TableField(value = "invoice_id")
    private Long invoiceId;

    /**
     * 用户满意度
     */
    @TableField(value = "custom_satisfaction")
    private Integer customSatisfaction;

    /**
     * 用户评价
     */
    @TableField(value = "custom_evaluation")
    private String customEvaluation;

    /**
     * 创建时间
     */
    @TableField(value = "create_time")
    private Date createTime;

    /**
     * 完成时间
     */
    @TableField(value = "complete_time")
    private Date completeTime;

    /**
     * 更新时间
     */
    @TableField(value = "update_time")
    private Date updateTime;

    /**
     * 是否删除
     */
    @TableField(value = "deleted")
    private Integer deleted;

    @TableField(exist = false)
    private static final long serialVersionUID = 1L;

    @Override
    public boolean equals(Object that) {
        if (this == that) {
            return true;
        }
        if (that == null) {
            return false;
        }
        if (getClass() != that.getClass()) {
            return false;
        }
        TaskOrderPO other = (TaskOrderPO) that;
        return (this.getTaskId() == null ? other.getTaskId() == null : this.getTaskId().equals(other.getTaskId()))
            && (this.getTaskType() == null ? other.getTaskType() == null : this.getTaskType().equals(other.getTaskType()))
            && (this.getTaskStatus() == null ? other.getTaskStatus() == null : this.getTaskStatus().equals(other.getTaskStatus()))
            && (this.getSubstationId() == null ? other.getSubstationId() == null : this.getSubstationId().equals(other.getSubstationId()))
            && (this.getOrderInfo() == null ? other.getOrderInfo() == null : this.getOrderInfo().equals(other.getOrderInfo()))
            && (this.getCustomInfo() == null ? other.getCustomInfo() == null : this.getCustomInfo().equals(other.getCustomInfo()))
            && (this.getCourierInfo() == null ? other.getCourierInfo() == null : this.getCourierInfo().equals(other.getCourierInfo()))
            && (this.getTaskRemark() == null ? other.getTaskRemark() == null : this.getTaskRemark().equals(other.getTaskRemark()))
            && (this.getInvoiceId() == null ? other.getInvoiceId() == null : this.getInvoiceId().equals(other.getInvoiceId()))
            && (this.getCustomSatisfaction() == null ? other.getCustomSatisfaction() == null : this.getCustomSatisfaction().equals(other.getCustomSatisfaction()))
            && (this.getCustomEvaluation() == null ? other.getCustomEvaluation() == null : this.getCustomEvaluation().equals(other.getCustomEvaluation()))
            && (this.getCreateTime() == null ? other.getCreateTime() == null : this.getCreateTime().equals(other.getCreateTime()))
            && (this.getCompleteTime() == null ? other.getCompleteTime() == null : this.getCompleteTime().equals(other.getCompleteTime()))
            && (this.getUpdateTime() == null ? other.getUpdateTime() == null : this.getUpdateTime().equals(other.getUpdateTime()))
            && (this.getDeleted() == null ? other.getDeleted() == null : this.getDeleted().equals(other.getDeleted()));
    }

    @Override
    public int hashCode() {
        final int prime = 31;
        int result = 1;
        result = prime * result + ((getTaskId() == null) ? 0 : getTaskId().hashCode());
        result = prime * result + ((getTaskType() == null) ? 0 : getTaskType().hashCode());
        result = prime * result + ((getTaskStatus() == null) ? 0 : getTaskStatus().hashCode());
        result = prime * result + ((getSubstationId() == null) ? 0 : getSubstationId().hashCode());
        result = prime * result + ((getOrderInfo() == null) ? 0 : getOrderInfo().hashCode());
        result = prime * result + ((getCustomInfo() == null) ? 0 : getCustomInfo().hashCode());
        result = prime * result + ((getCourierInfo() == null) ? 0 : getCourierInfo().hashCode());
        result = prime * result + ((getTaskRemark() == null) ? 0 : getTaskRemark().hashCode());
        result = prime * result + ((getInvoiceId() == null) ? 0 : getInvoiceId().hashCode());
        result = prime * result + ((getCustomSatisfaction() == null) ? 0 : getCustomSatisfaction().hashCode());
        result = prime * result + ((getCustomEvaluation() == null) ? 0 : getCustomEvaluation().hashCode());
        result = prime * result + ((getCreateTime() == null) ? 0 : getCreateTime().hashCode());
        result = prime * result + ((getCompleteTime() == null) ? 0 : getCompleteTime().hashCode());
        result = prime * result + ((getUpdateTime() == null) ? 0 : getUpdateTime().hashCode());
        result = prime * result + ((getDeleted() == null) ? 0 : getDeleted().hashCode());
        return result;
    }

    @Override
    public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append(getClass().getSimpleName());
        sb.append(" [");
        sb.append("Hash = ").append(hashCode());
        sb.append(", taskId=").append(taskId);
        sb.append(", taskType=").append(taskType);
        sb.append(", taskStatus=").append(taskStatus);
        sb.append(", substationId=").append(substationId);
        sb.append(", orderInfo=").append(orderInfo);
        sb.append(", customInfo=").append(customInfo);
        sb.append(", courierInfo=").append(courierInfo);
        sb.append(", taskRemark=").append(taskRemark);
        sb.append(", invoiceId=").append(invoiceId);
        sb.append(", customSatisfaction=").append(customSatisfaction);
        sb.append(", customEvaluation=").append(customEvaluation);
        sb.append(", createTime=").append(createTime);
        sb.append(", completeTime=").append(completeTime);
        sb.append(", updateTime=").append(updateTime);
        sb.append(", deleted=").append(deleted);
        sb.append(", serialVersionUID=").append(serialVersionUID);
        sb.append("]");
        return sb.toString();
    }
}